package vista;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;

import modelo.ProbarMetodosFabricaCreador;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaCategoria extends javax.swing.JFrame{
        private JPanel jPanCategoria;
        private JLabel jlblCodCategoria;
        private JButton jbtnRegistrar;
        private JButton jbtnImagen;
        private JButton jbtnBuscar;
        private JButton jbtnCancelar;
        private JButton jbtnSalir;
        private JTextField jtxtDescripcionCateg;
        private JTextField jtxtCodigoCateg;
        private JLabel jlblDatosCategoria;
        private JLabel jlblDescripcionCateg;

        /**
        * Auto-generated main method to display this JFrame
        */
        public static void main(String[] args) {
                SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                                VentanaCategoria instCateg = new VentanaCategoria();
                                instCateg.setLocationRelativeTo(null);
                                new ProbarMetodosFabricaCreador();
                                instCateg.setVisible(true);
                        }
                });
        }
        
        public VentanaCategoria() {
                super();
                initGUI();
        }       
        
        private void initGUI() {
                try {
                        getContentPane().setLayout(null);
                        {
                                this.setTitle("Gestión de Categorias");
                                getContentPane().setBackground(new java.awt.Color(82,209,232));
                                jPanCategoria = new JPanel();
                                getContentPane().add(jPanCategoria);
                                jPanCategoria.setLayout(null);
                                jPanCategoria.setBackground(new java.awt.Color(255,255,255));
                                jPanCategoria.setBounds(7, 12, 568, 244);
                                {
                                        jlblCodCategoria = new JLabel();
                                        jlblCodCategoria.setText("Código Categoría");
                                }
                                {
                                        jbtnRegistrar = new JButton();
                                        jbtnRegistrar.setLayout(null);
                                        jbtnRegistrar.setText("Registrar");
                                }
                                {
                                        jbtnCancelar = new JButton();
                                        jbtnCancelar.setLayout(null);
                                        jbtnCancelar.setText("Cancelar");
                                }
                                {
                                        jbtnSalir = new JButton();
                                        jbtnSalir.setLayout(null);
                                        jbtnSalir.setText("Salir");
                                }
                                {
                                        jlblDescripcionCateg = new JLabel();
                                        jlblDescripcionCateg.setText("Descripción");
                                }
                                {
                                        jlblDatosCategoria = new JLabel();
                                        jlblDatosCategoria.setText("Datos de la Categoria");
                                }
                                {
                                        jbtnBuscar = new JButton();
                                        jbtnBuscar.setText("Buscar");
                                }
                                {
                                        jtxtCodigoCateg = new JTextField();
                                        jPanCategoria.add(jtxtCodigoCateg);
                                        jtxtCodigoCateg.setBounds(369, 70, 107, 21);
                                }
                                {
                                        jtxtDescripcionCateg = new JTextField();
                                        jPanCategoria.add(jtxtDescripcionCateg);
                                        jPanCategoria.add(jbtnCancelar, "DEFAULT_WIDTH");
                                        jPanCategoria.add(jbtnSalir, "DEFAULT_WIDTH");
                                        jPanCategoria.add(jbtnRegistrar, "DEFAULT_WIDTH");
                                        jPanCategoria.add(jlblDescripcionCateg, "DEFAULT_WIDTH");
                                        jPanCategoria.add(jlblCodCategoria, "DEFAULT_WIDTH");
                                        jPanCategoria.add(jlblDatosCategoria, "DEFAULT_WIDTH");
                                        jPanCategoria.add(jbtnBuscar);
                                        jbtnBuscar.setBounds(482, 70, 59, 21);
                                        jbtnBuscar.setBackground(new java.awt.Color(82,209,232));
                                        jbtnBuscar.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                                        {
                                                jbtnImagen = new JButton();
                                                jPanCategoria.add(jbtnImagen);
                                                jbtnImagen.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagen.jpg")));
                                                jbtnImagen.setBounds(21, 45, 183, 162);
                                                jbtnImagen.setBackground(new java.awt.Color(82,209,232));
                                                jbtnImagen.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                                        }
                                        jlblDatosCategoria.setBounds(21, 18, 523, 21);
                                        jlblDatosCategoria.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                                        jlblDatosCategoria.setBackground(new java.awt.Color(82,209,232));
                                        jlblCodCategoria.setBounds(232, 70, 125, 21);
                                        jlblDescripcionCateg.setBounds(232, 100, 109, 14);
                                        jbtnRegistrar.setBounds(276, 137, 71, 30);
                                        jbtnRegistrar.setBackground(new java.awt.Color(82,209,232));
                                        jbtnRegistrar.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                                        jbtnSalir.setBounds(469, 139, 68, 27);
                                        jbtnSalir.setBackground(new java.awt.Color(82,209,232));
                                        jbtnSalir.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                                        jbtnCancelar.setBounds(374, 137, 69, 30);
                                        jbtnCancelar.setBackground(new java.awt.Color(82,209,232));
                                        jbtnCancelar.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                                        jtxtDescripcionCateg.setBounds(369, 97, 172, 21);
                                }
                        }
                        {
                                this.setSize(595, 293);
                        }
                } catch(Exception e) {
                        e.printStackTrace();
                }
        }

        public void addListener(ActionListener actionListener){
                this.jbtnBuscar.addActionListener(actionListener);
                this.jbtnCancelar.addActionListener(actionListener);
                this.jbtnRegistrar.addActionListener(actionListener);
                this.jbtnSalir.addActionListener(actionListener);
        }

        public void mostrarMensaje(String mensaje) {
                JOptionPane.showMessageDialog(this, mensaje);
        }
        
        public String getDescripcionCateg() {
                return jtxtDescripcionCateg.getText();
        }

        public void setJtxtDescripcionCateg(String valor) {
                this.jtxtDescripcionCateg.setText(valor);
        }

        public String getCodCategoria() {
                return jtxtCodigoCateg.getText();
        }

        public void setJtxtCodigoCateg(JTextField jtxtCodigoCateg) {
                this.jtxtCodigoCateg = jtxtCodigoCateg;
        }
        
        public void borrarDatos() {
                jtxtCodigoCateg.setText("");
                jtxtDescripcionCateg.setText("");
        }
}
